package com.springboot.demo.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * 自定义BeanPostProcessor
 *
 * @author supu
 * @date 2019-12-24 11:23
 **/
public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean,
                                                  String beanName) throws BeansException {
        System.out.println("BeanPostProcessor postProcessBeforeInitialization 方法被调用");
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean,
                                                 String beanName) throws BeansException {
        System.out.println("BeanPostProcessor postProcessAfterInitialization 方法被调用");
        return bean;
    }
}
